package spring.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import spring.dao.IDao;
import spring.service.Iservice;

@Service("testService")
@Scope("prototype")
public class ServiceImpl implements Iservice {
	@Autowired//<property />
	@Qualifier("dao")
	private IDao dao;
	
	public ServiceImpl() {
	}

	public ServiceImpl(IDao dao) {
		this.dao = dao;
	}

	public void setDao(IDao dao) {
		this.dao = dao;
	}

	public String add(String msg) {
		// TODO Auto-generated method stub
		dao.save();
		System.out.println(this);
		if (false) throw new RuntimeException();
		return msg;
	}

}
